//
//  InsuranceViewController.m
//  PhotoAnnotate
//
//  Created by Bassem El-Tamimi on 15.01.11.
//  Copyright 2011 ePapyrus GmbH. All rights reserved.
//

#import "InsuranceViewController.h"
#import "InsuranceDataEntryViewController.h"
#import "Insurance.h"
#import "InsuranceTabbarController.h"

#define FEATURES_TAB 1
#define INSURE_TAB 2
#define STATUS_TAB 3

@implementation InsuranceViewController

@synthesize insuranceDataEntryViewController;
@synthesize insuranceData;

- (void)viewDidLoad 
{
    [super viewDidLoad];
		
	[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:NO];
	self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
	
	[self setWantsFullScreenLayout:YES];

	
	NSURL *url = [[NSBundle mainBundle] URLForResource:@"EWPv37.ad/AdUnit/index" withExtension:@"html"];
	
	NSURLRequest *request = [NSURLRequest requestWithURL:url];
	
	[webView loadRequest:request];
	
	
	for (id subview in webView.subviews) {
		if ([[subview class] isSubclassOfClass: [UIScrollView class]]) {
			UIScrollView* scrollView = (UIScrollView *)subview;
			scrollView.bounces = NO;
			break;
		}
	}
	
//	if (!self.insuranceData) {
//		self.insuranceData = [[Insurance alloc] init];
//	}
	
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/


-(BOOL)webView:(UIWebView *)descriptionTextView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    if (UIWebViewNavigationTypeLinkClicked == navigationType) {
        [[UIApplication sharedApplication] openURL:[request URL]];
        return NO;
    }
    return YES;
}

- (IBAction)closeInsuranceView
{
    [self dismissModalViewControllerAnimated:YES];
    
	/*
	CATransition *transition = [CATransition animation];
	transition.duration = 0.5; 
	transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
	transition.type = kCATransitionPush;
	transition.subtype = kCATransitionFromBottom;
	transition.delegate = self;
	[self.navigationController.view.layer addAnimation:transition forKey:nil];
	
	[self.navigationController popViewControllerAnimated:NO];
    */

}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
}


- (void)dealloc {
    [super dealloc];
}


@end
